<?php

include_once 'dbtable.php';

function get_all_job(pager $page,$url) {
    $sql = "select vieclam.*,user.* from vieclam,user where vieclam.user_id = user.id and vieclam.status = 1";
    return DbTable::Paging($page, $sql, $url,15);
}
function get_all_job_to_left_bar() {
    $sql = "select vieclam.*,user.* from vieclam,user where vieclam.user_id = user.id and vieclam.status = 1 order by vieclam.id desc limit 0,5";
    return DbTable::getData($sql);
}
function get_job_by_id($id) {
    $sql = "select vieclam.*,user.* from vieclam,user where vieclam.user_id = user.id and vieclam.status = 1 and vieclam.id = '{$id}'";
    return DbTable::getData($sql);
}
function them_moi_job($array) {
    if (DbTable::insert("vieclam", $array)) {
        return true;
    }
    return false;
}

function sua_job($array, $id) {
    if (DbTable::update("vieclam", $array, $id)) {
        return true;
    }
    return false;
}
function xoa_job($id) {
    if(DbTable::delete("vieclam", $id)){
        return true;
    }
    return false;
}
?>
